// pages/user/interest/interest/interest.js
import api from '../../../api/index'
import store from '../../../store/index'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    contests:[{
      images:['/images/华农1.jpg'],
      name: '中国国际“互联网+”大学生创新创业大赛',
      createTime: '02-05',
      status: '报名中'
    },
    {
      images:['/images/华农2.jpg'],
      name: '中国国际“互联网+”大学生创新创业大赛',
      creatTime: '02-05',
      status: '报名中'
    },
    {
      images:['/images/华农1.jpg'],
      name: '中国国际“互联网+”大学生创新创业大赛',
      creatTime: '02-05',
      status: '报名中'
    }],
    sectionArray: ['报名中','已截至'],
    activeIndex: 0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.list()
  },
  changeActive:function(e) {
    this.setData({
      activeIndex: e.detail.index
    })
  },
  list:function(){
    var list = store.data.user.collect
    var params = {list}
    api.userInfo.collectList(params).then(res=>{
      console.log(res)
      this.setData({
        contests:res
      })
    })
  },
  tapTask: function(e) {
    var index =  e.currentTarget.dataset.index
    console.log(index)
    var contest = this.data.contestItems[index]
    wx.navigateTo({
      url: '../../contest/detail?contest='+JSON.stringify(contest),
    })
  },
})